home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
T-TPUG Old Monthly Disks
/
(c)t2.d64
/
coin flip 3.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
395b
|
20 lines
100 REM***COIN FLIPPER #3
200 REM***FIND OUT HOW MANY FLIPS
210 PRINT"[147]";
215 PRINT
220 INPUT "HOW MANY COIN FLIPS";N
230 PRINT
300 REM***T = TAILS COUNTER H = HEADS COUNTER
310 T = 0
320 H = 0
400 REM***FLIP COIN N TIMES, COUNT TAILS AND HEADS
410 FOR K = 1 TO N
420 COIN = INT(2*RND(1))
430 IF COIN = 0 THEN T=T+1
440 IF COIN = 1 THEN H=H+1
450 NEXT K
460 PRINT
500 REM***PRINT RESULTS OF N FLIPS
510 PRINT"I GOT"H"HEADS AND"T"TAILS."
999 END